TypeScript 97.4%
SQL 1%
JavaScript 0.9%
CSS 0.6%
1import { withUser, json } from "@/lib/api";2import { getArenaShare, revokeArenaShare, shareArenaSession } from "@/lib/arena/service";3import { LIMITS } from "@/lib/rate-limit";45export const dynamic = "force-dynamic";6type P = { id: string };78/** GET /api/arena/:id/share → { share: { id, createdAt, viewCount } | null } */9export const GET = withUser<P>(async ({ user }, { id }) => json({ share: await getArenaShare(user.id, id) }));1011/** POST /api/arena/:id/share → { share } — creates (or refreshes) the public snapshot at /share/arena/:shareId. */12export const POST = withUser<P>(async ({ user }, { id }) => json({ share: await shareArenaSession(user.id, id) }, { status: 201 }), { limit: { ...LIMITS.share, key: "arena-share" } });1314/** DELETE /api/arena/:id/share → { ok } — revokes every active link for the session. */15export const DELETE = withUser<P>(async ({ user }, { id }) => {16 await revokeArenaShare(user.id, id);17 return json({ ok: true });18});19